package Io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Practice3 {
    public static void main(String[] args) throws IOException ,ClassNotFoundException{


        FileInputStream fis=new FileInputStream("prac.txt");
        InputStreamReader isr=new InputStreamReader(fis, StandardCharsets.UTF_8);
        int a;
        while ((a=isr.read())!=-1){
            System.out.println((char) a);
        }
        isr.close();







/*
        FileOutputStream fos=new FileOutputStream("prac.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("jjjjj");
        osw.write("qqqqq");
        System.out.println("finish");
        osw.close();







 */

/*
        FileInputStream fis=new FileInputStream("student.obj");
        ObjectInputStream ois=new ObjectInputStream(fis);
        Object obj= ois.readObject();
        Student zs=(Student) obj;
        System.out.println(zs);
        ois.close();





        /* String name = "张三";
        int age = 2;
        String gender= "男";
        String[]otherInfo={"学生","小山村","练习两年半","喜欢唱跳rap"};
        Student zs = new Student(name,age,gender,otherInfo);
        System.out.println(zs);

        FileOutputStream fos = new FileOutputStream("student.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(zs);
        System.out.println("finish");
        oos.close();










 */




        /*
        FileInputStream fis=new FileInputStream("aaaa.jpg");
        FileOutputStream fos=new FileOutputStream("copy.jpg");
        BufferedInputStream bis=new BufferedInputStream(fis);
        BufferedOutputStream bos=new BufferedOutputStream(fos);
        int a;
        while ((a=bis.read())!=-1){
            bos.write(a);
        }
        bis.close();
        bos.close();

         */

    }
}
